<?php
declare (strict_types = 1);

namespace app\command\backend\system;

use app\service\logic\common\system\RoleService;
use think\console\Input;
use think\console\Output;
use think\console\Command;

/**
 * 角色初始化 执行一次
 *
 * Class RoleInit
 * @package app\command\backend\system
 */
class RoleInit extends Command
{
    protected function configure()
    {
        // 指令配置
        $this->setName('role init')
            ->setDescription('the role init command');
    }

    protected function execute(Input $input, Output $output)
    {
        // 固定数据创建
        $result = invoke(RoleService::class)->initData();
        $output->writeln('生成数据条数: ' . $result);

        // 指令输出
        $output->writeln('done');
    }
}
